import request from '@/utils/request';

const PRE_URL = '/forecast/result';
const PRE_URL_PROGRESS = '/forecast/progress';
/**
 * 根据Id获取
 * @param {*} params
 */
export async function getById(gmvId) {
  return request(`${PRE_URL}/getById`, {
    method: 'POST',
    data: {
      id: gmvId,
    },
  });
}

/**
 * 修改预测信息
 * @param {*} params
 */
export async function editResult(params) {
  return request(`${PRE_URL}/update`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 查询
 * @param {*} params
 */
export async function queryResult(params) {
  return request(`${PRE_URL}/getByPage`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 查询指定的预测操作日志
 * @param {*} gmvId
 */
export async function queryOptLog(resultId) {
  return request(`${PRE_URL}/listLog`, {
    method: 'POST',
    data: {
      id: resultId,
    },
  });
}

/**
 * 根据GMV调整
 * @param {*} params
 */
export async function adjustByGmv(params) {
  return request(`${PRE_URL}/adjustByGmv`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 对预测结果进行检测
 * @param {String}} params
 */
export async function verifyResult(params) {
  return request(`${PRE_URL}/verify`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 流转至运营
 * @param {*} params
 */
export async function turnoverToSale(params) {
  return request(`${PRE_URL}/updateToSale`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 发送预测信号
 * @param {*} params
 */
export async function sendForecastSign(params) {
  return request(`${PRE_URL}/updateToInstruction`, {
    method: 'POST',
    data: params,
  });
}

export async function updateToVerification(params) {
  return request(`${PRE_URL}/updateToVerification`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 手动通过检测
 * @param {*} params
 */
export async function manualPass(params) {
  return request(`${PRE_URL}/manualPass`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 批量通过检测
 * @param {*} params
 */
export async function batchPassCheck(params) {
  return request(`${PRE_URL}/batchManualPass`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
/**
 * 批量修改
 * @param {*} params
 */
export async function handBatchEdit(params) {
  return request(`${PRE_URL}/handBatchEdit`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 查询预测进度
 * @param {*} params
 */
export async function queryForecastProgress(params) {
  return request(`${PRE_URL_PROGRESS}/getProgress`, {
    method: 'POST',
    data: {
      params,
    },
  });
}
